<template>
  <div class="s-workingCondition">
    <template v-if="state.WorkLawList && state.WorkLawList.length > 0">
      <div class="item" @click="workingDetail(d)" v-for="d in state.WorkLawList" :key="d.id">
        <p class="ell titleText">
          <i></i>
          {{ d.title }}
        </p>
        <p>{{ d.release_time }}</p>
      </div>
    </template>
    <el-empty v-else></el-empty>
  </div>
</template>
<script setup>
import { ref, reactive, onMounted, inject } from "vue";
import { useRouter } from "vue-router";
const route = useRouter();
const http = inject("ajax");
onMounted(() => {
  getData();
});

let state = reactive({
  WorkLawList: [],
});

const getData = () => {
  http("/iaiqsmde9fea569965ed56ab98ea0501752fe631902841e/open/workLaw/queryWorkLaw", {}, "GET")
    .then(res => {
      if (res.code == 0) state.WorkLawList = res.data.rows;
    })
    .catch(err => {
      console.log(err.message || "数据异常");
    });
};
const workingDetail = d => {
  route.push({
    path: "/workingDetail",
    query: {
      id: d.id,
    },
  });
};
</script>
